home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Where.c
-
- Contains: A sample dcmd which displays information about a trap or address.
-
- Written by: JM3 = Jim Murphy
-
- Copyright: ⌐ 1991, 1994, 1996, 1998 by Apple Computer, Inc., All Rights Reserved.
-
- File Ownership:
-
- DRI: Jim Murphy
-
- Other Contact: Dave Lyons
-
- Technology: MacsBug 6.5.x
-
- Writers:
-
- (DAL) Dave Lyons
-
- Change History (most recent first):
-
- <5> 1/13/98 DAL ElseCop 1.0.
- <4> 25-Jan-96 JM3 Updated the sample build commands to be current.
- <3> 11-Dec-94 JM3 Bleh. I somehow deleted a couple of lines at the end.
- <2> 10-Dec-94 JM3 Updated for new version 3 dcmd requirements.
-
- The following MPW commands will build the dcmd and copy it to the "Debugger Prefs" file
- in the System folder. The dcmd's name in MacsBug will be the name of the file built by
- the Linker.
-
- C Where.c
- Link -o Where -sg Main=STDCLIB,STDIO,SANELIB dcmdGlue.a.o Where.c.o" "{Libraries}Runtime.o"
- BuildDcmd Where 199 -format3
- Echo 'include "Where";' | Rez -a -o "{systemFolder}Debugger Prefs"
-
- */
-
- #include <Memory.h>
- #include <Types.h>
- #include "dcmd.h"
-
-
- pascal void CommandEntry (dcmdBlock* paramPtr)
- {
-
- short ch;
- long address;
- Boolean ok;
- Str255 name;
-
- static const char usageStr[] = "\p[addr | trap]";
-
- switch (paramPtr->request)
- {
- case dcmdInit:
- break;
-
- case dcmdHelp:
- dcmdDrawLine("\pDisplay information about the address or trap.");
- dcmdDrawLine("\pIf no parameter then use PC as the address.");
- break;
-
- case dcmdGetInfo:
- * (long *) &((GetInfoRequestBlockPtr) paramPtr->requestIOBlock)->dcmdVersion = 0x03008000; // version 3.0 final
- BlockMoveData(&usageStr, &((GetInfoRequestBlockPtr) paramPtr->requestIOBlock)->usageStr, usageStr[0]+1);
- break;
-
- case dcmdDoIt:
- if (dcmdPeekAtNextChar () == '\n')
- {
- address = paramPtr->registerFile[PCRegister];
- }
- else
- {
- ch = dcmdGetNextExpression (&address, &ok);
- if (!ok)
- {
- dcmdDrawLine ("\pSyntax error");
- return;
- }
- }
-
- if (address >= 0x0000A000 && address <= 0x0000ABFF)
- {
- dcmdGetTrapName (address, name);
- dcmdDrawLine (name);
- }
- else
- {
- dcmdGetNameAndOffset (address, name);
- if (name[0] > 0)
- dcmdDrawLine (name);
- else
- dcmdDrawLine ("\pNo procedure name found");
- }
- break;
- }
- } // CommandEntry
-